var t = require("../../utils/http.js"),
  e = require("../../utils/api.js"),
  n = require("../../utils/language/switchLanguage.js");
Page({
  data: { content: "", type: "", winHeight: 0, isActive: !1, languageType: "" },
  onLoad: function (t) {
    this.setData({ height: wx.getSystemInfoSync().windowHeight - 108 }),
      this.initLanguage(),
      null != t.type
        ? (this.setData({ type: t.type }), this.getTeamConfig({ type: t.type }))
        : this.getUniversalTicketConfig();
  },
  initLanguage: function () {
    var t = n.languageVersion(wx.getStorageSync("language"));
    this.setData({ _t: t, languageType: wx.getStorageSync("language") }),
      wx.setNavigationBarTitle({ title: t["购票须知"] });
  },
  getUniversalTicketConfig: function () {
    var e = this;
    t.getUniversalTicketConfig().then(function (t) {
      var n = 0 == e.data.languageType ? t.data.notice : t.data.noticeEn;
      e.setData({ content: n }), e.get_height("#content");
    });
  },
  getTeamConfig: function (e) {
    var n = this;
    t.getTeamConfig(e).then(function (t) {
      var e =
        0 == n.data.languageType
          ? t.data.bookingNotes
          : t.data.bookingNotesEn
            ? t.data.bookingNotesEn
            : t.data.bookingNotes;
      console.log(e, "newDataBooking"),
        n.setData({ content: e }),
        n.get_height("#content");
    });
  },
  get_height: function (t) {
    var e = this;
    setTimeout(function () {
      wx.createSelectorQuery()
        .in(e)
        .select(t)
        .boundingClientRect(function (t) {
          var n = t.height;
          t.width;
          n < e.data.height && e.setData({ isActive: !0 });
        })
        .exec();
    }, 200);
  },
  scrollToLower: function (t) {
    this.setData({ isActive: !0 });
  },
  toPage: function () {
    this.data.isActive
      ? "" != this.data.type
        ? wx.navigateTo({
            url: "plugin-private://wx393d60d93f70599c/pages/teamAppointment/index?type=".concat(
              this.data.type,
            ),
          })
        : wx.navigateTo({
            url: "plugin-private://wx393d60d93f70599c/pages/buyTicket/index",
          })
      : e.showMsg(this.data._t["请先阅读预约须知"]);
  },
  onReady: function () {},
  onShow: function () {},
  onHide: function () {},
  onUnload: function () {},
  onPullDownRefresh: function () {},
  onReachBottom: function () {},
});
